package com.codinghero.zqlb.spider.handler;

import java.util.List;

import com.codinghero.sql.MySQLOper;
import com.codinghero.zqlb.Constant;
import com.codinghero.zqlb.match.SoccerMatch;

@Deprecated
public class TempToRealHandler implements MatchHandler {

	public <T extends SoccerMatch> void handle(List<T> list) {
		MySQLOper dbOper = new MySQLOper(Constant.JDBC_URL, Constant.USER_ID,
				Constant.PASSWORD);
		try {
			dbOper.connect();
			dbOper.startTransaction();
			dbOper.executeUpdate("INSERT INTO zqlb_soccer_match" +
					"(typeId, typeName, startDate, endDate, team1Id, team2Id, " +
					"team1Name, team2Name, typeFocused, team1Focused, team2Focused, " +
					"channelIds, channelNames, " +
					"status, insertTime) SELECT " +
					"typeId, typeName, startDate, endDate, team1Id, team2Id, " +
					"team1Name, team2Name, typeFocused, team1Focused, team2Focused, " +
					"channelIds, channelNames, " +
					"status, NOW() " +
					"FROM zqlb_soccer_match_temp");
			dbOper.commit();
		} catch (Exception e) {
			dbOper.rollback();
			e.printStackTrace();
		} finally {
			dbOper.close();
		}
	}

}
